<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        var hello = "helloworld";
        str = "ell";
        //判断字符串是否存在，是否在头部，是否在尾部的三个方法
        console.log(hello.includes(str));//true
        console.log(hello.startsWith("h"));//true
        console.log(hello.endsWith("l"));//false

        var a = "x";
        //返回重复n次的字符串
        console.log(a.repeat(5));
        
        var x = "abc";
        //头部补全和尾部补全
        console.log(x.padStart(10, '12'));
        console.log(x.padEnd(10, '12'));
        
        var it = "   itbaizhan    ";
        //消除头部尾部空格
        console.log(it);
        console.log(it.trim());
        console.log(it.trimEnd());
        console.log(it.trimStart());

        //at方法，返回字符串下标对应的值，支持负下标
        console.log(it.at(5));
        console.log(it.at(-5));

        


    </script>
</body>
</html>